<template>
  <div class="home-content">
    <div class="card-row">
      <div class="info-card">
        <el-icon class="card-icon card-icon-blue"><Operation /></el-icon>
        <div class="card-title">隧道数量</div>
        <div class="card-value">10个</div>
      </div>
      <div class="info-card">
        <el-icon class="card-icon card-icon-green"><ScaleToOriginal /></el-icon>
        <div class="card-title">检验合格</div>
        <div class="card-value">2个</div>
      </div>
      <div class="info-card">
        <el-icon class="card-icon card-icon-orange"><DocumentChecked /></el-icon>
        <div class="card-title">正在施工</div>
        <div class="card-value">7个</div>
      </div>
      <div class="info-card">
        <el-icon class="card-icon card-icon-purple"><DataLine /></el-icon>
        <div class="card-title">地质预报</div>
        <div class="card-value">2个</div>
      </div>
    </div>
    <div class="line" id="line"></div>
  </div>
</template>

<script setup>
import { Operation, ScaleToOriginal, DocumentChecked, DataLine } from '@element-plus/icons-vue'
import { onMounted, getCurrentInstance } from 'vue'
import api from '@/api/index.js'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()

onMounted(() => {
  api.getLine().then(res => { 
    console.log(res.data.result.lines);

    if(res.data.status === 200) {
        proxy.$line('line', res.data.result.lines)
    }
  }).catch(err => { 
      
    })

  
})
</script>

<style scoped>
.home-content {
  padding: 0 10px;
  margin-top: 5px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
}
.info-card {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin: 0 10px;
  padding: 24px 0 18px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: box-shadow 0.2s;
}
.info-card:hover {
  box-shadow: 0 4px 16px rgba(64,158,255,0.4);
}
.card-icon {
  font-size: 36px;
  margin-bottom: 10px;
}
.card-icon-blue {
  color: #409eff;
}
.card-icon-green {
  color: #67c23a;
}
.card-icon-orange {
  color: #e6a23c;
}
.card-icon-purple {
  color: #a279e6;
}
.card-title {
  font-size: 16px;
  color: #666;
  margin-bottom: 4px;
}
.card-value {
  font-size: 22px;
  color: #222;
  font-weight: bold;
}

.line {
  height: 300px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-top: 32px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>